package com.javabean;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;

import com.model.DataBase;

public class IsDeadline {
	Connection con = DataBase.getConnection();
	PreparedStatement pre;
	ResultSet rs;
	Statement sta;
	ArrayList<String> find = new ArrayList<String>();

	public ArrayList<String> findOverTime() {
		Date date = new Date();
		String sql="select edate,type,serial,model from device where isUse=? and  state=?";
		try {
			pre=con.prepareStatement(sql);
			pre.setString(1, "yes");
			pre.setString(2, "yes");
			rs=pre.executeQuery();
			while(rs.next()){
				Date deadline=rs.getDate(1);
				boolean flag = date.before(deadline);
				if(!flag){
					find.add(rs.getString(2));
					find.add(rs.getString(3));
					find.add(rs.getString(4));
				}
			}
					
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		return find;

	}
	
}
